home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 4 / 004.d81 / grades 2 (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  4KB  |  156 lines

  1. 2 sp$="                                       "
  2. 5 rem**load "grades 2",8
  3. 10 rem**grade averaging*sort routines
  4. 20 rem**john l eubanks,ph.d
  5. 30 rem**pineville, louisiana 71360
  6. 40 rem**
  7. 50 rem**03/13/84
  8. 60 rem**
  9. 65 print"[147]"
  10. 68 print"**********[158]teacher's gradebook [146]**********[159]"
  11. 70 print""
  12. 73 print"             version 2.0      [146][159]"
  13. 75 print""
  14. 80 print"           john l eubanks,ph.d[146][159]"
  15. 82 print:print:print:print
  16. 85 for i=1to2000 :nexti:print"[147]"
  17. 100 print"you may average any number of grades   "
  18. 110 print"for any number of students and         "
  19. 115 print"calculate the letter grades for your[146] "
  20. 120 print"grading system."
  21. 130 print"if you wish to make a hard copy[146]"
  22. 135 print"connect your printer now.      [146]"
  23. 140 print""
  24. 150 print"[158]this program does not save to disk.[146]"
  25. 153 print"you should send data to the printer[146]"
  26. 155 print"or copy the data by hand before    [146]"
  27. 157 print"turning off the computer.          [146][159]"
  28. 158 print""
  29. 165 print
  30. 167 dim n$(200),g(50),a(200),gl$(200)
  31. 170 input"press return to begin";r$
  32. 180 if r$="" then 300
  33. 290 rem**input variable length and dim
  34. 300 print"[147]"
  35. 320 input"enter the number of students";n%:print
  36. 340 input"how many grades per student ";ng
  37. 343 print
  38. 360 print"you may enter the names of";n%;"students"
  39. 365 print"with a maximum of";ng;"grades per student.":print
  40. 370 input"press return to continue";c$
  41. 375 if c$="" then 400
  42. 400 print"[147]"
  43. 490 rem**input student names
  44. 500 forx=1ton%:print"[147]"
  45. 510 print"when you are asked,type the"
  46. 520 print"student's name--last first"
  47. 530 print"[158]do not use commas in entry[159][146]"
  48. 540 print""
  49. 550 print"what is student's name?":print
  50. 560 input n$(x): print
  51. 570 rem**input grades
  52. 580 input"how many grades for [146][158]this[146][159] student";sg:print
  53. 595 if sg=<ng then 603
  54. 600 if sg>ng then print"you can only enter";ng;"grades"
  55. 602 print"<press a key>":poke198,0:wait198,1:goto580
  56. 603 let s=0
  57. 605 rem**input grades
  58. 610 for y=1tosg:print"[147]"
  59. 620 print"what is student's grade #"y" ?"
  60. 625 input g(y)
  61. 635 rem**calculate grade average
  62. 640 s=g(y)+s
  63. 650 next y
  64. 660 a(x)=s/sg:a(x)=int(a(x)+.5)
  65. 670 z=z+1
  66. 680 next x:   rem**main loop return
  67. 700 rem**input letter grade values
  68. 710 print"[147]"
  69. 730 print"enter the (numerical) lower"
  70. 740 print"limits for each letter grade":print
  71. 750 input"lower limit of 'a'";b:print
  72. 760 input"lower limit of 'b'";c:print
  73. 770 input"lower limit of 'c'";d:print
  74. 780 input"lower limit of 'd'";e:print
  75. 785 rem**calculate upper limits
  76. 790 let bl=abs(b-1):let cl=abs(c-1):let dl=abs(d-1):let el=abs(e-1)
  77. 840 rem**display grade values
  78. 850 print"[147]":print"your grading system is: [146][159]"
  79. 860 print"[158]a=";b;"and above"
  80. 870 print"b=";c;"to";bl
  81. 880 print"c=";d;"to";cl
  82. 890 print"d=";e;"to";dl
  83. 900 print"f=";el;"and below[159]":print:print
  84. 902 input"press return to continue";v$
  85. 905 if v$="" then 910
  86. 910 rem**convert num averages to letters
  87. 915 for x=1ton%
  88. 920 if a(x) =>b then gl$(x) ="a"
  89. 930 if a(x) =>c and a(x) <b then gl$(x) ="b"
  90. 940 if a(x) =>d and a(x) <c then gl$(x) ="c"
  91. 950 if a(x) =>e and a(x) <d then gl$(x) ="d"
  92. 960 if a(x) =<el then gl$(x) ="f"
  93. 965 next x
  94. 970 print"[147]":print"to arrange by name,type 'n'"
  95. 975 print:print"to arrange by average,type 'g'":print
  96. 980 input"type 'n' or 'g'";m$
  97. 985 if m$="g" then gosub 5000
  98. 987 if m$="n" then 3060
  99. 990 rem**print headings to screen
  100. 1000 print"[147]"
  101. 1010 print"student name";tab(23);"average";tab(33);"grade"
  102. 1020 print:print
  103. 1025 rem**output print loop for screen
  104. 1030 for x=1toz
  105. 1032 f=f+1
  106. 1035 if f>20 then gosub 7000
  107. 1040 print n$(x);tab(26);a(x);tab(36);gl$(x)
  108. 1050 nextx
  109. 1070 print
  110. 1080 rem**
  111. 1990 rem**hard copy option
  112. 2000 print"type 'p' to send to printer"
  113. 2005 print"type 'q' to quit"
  114. 2010 input"enter 'p' or 'q'";p$
  115. 2020 if p$="p" then 2060
  116. 2030 goto3020
  117. 2050 rem**output print loop for printer
  118. 2060 open 4,4 :cmd4
  119. 2070 print"student name","average","grade"
  120. 2080 print:print
  121. 2090 for x=1 to z
  122. 3000 print n$(x)left$(sp$,24-len(n$(x)))a(x)left$(sp$,16-len(str$(a(x))))gl$(x)
  123. 3010 next x:print#4:close4
  124. 3020 rem now is the time to end
  125. 3030 goto63000
  126. 3035 :
  127. 3040 :
  128. 3050 rem**arrange by name**bubble sort
  129. 3060 t=n%-1
  130. 3070 flip=0:for s=1tot:ifn$(s)<=n$(s+1)then 3130
  131. 3080 switch$=n$(s):ha=a(s):hg$=gl$(s)
  132. 3090 n$(s)=n$(s+1):a(s)=a(s+1):gl$(s)=gl$(s+1)
  133. 3100 n$(s+1)=switch$:a(s+1)=ha:gl$(s+1)=hg$
  134. 3110 flip=1:t=s
  135. 3130 next s:if flip=1 then3070
  136. 3140 goto 1000
  137. 4990 rem**arrange by grades*bubble sort
  138. 5000 t=n%-1
  139. 5010 flip=0:for s=1to t:if a(s)>=a(s+1) then 5060
  140. 5020 ha=a(s):switch$=n$(s):hg$=gl$(s)
  141. 5030 a(s)=a(s+1):n$(s)=n$(s+1):gl$(s)=gl$(s+1)
  142. 5040 a(s+1)=ha:n$(s+1)=switch$:gl$(s+1)=hg$
  143. 5050 flip=1:t=s
  144. 5060 next s:if flip=1 then 5010
  145. 5070 return
  146. 6990 rem**stop when screen fills
  147. 7000 print chr$(18);"hit any key to continue"
  148. 7010 get an$:if an$="" then 7010
  149. 7020 f=0:print chr$(146)
  150. 7030 return
  151. 63000 print"[147][144]want to try again? (y/n)":poke198,0:wait198,1:getz$
  152. 63002 ifz$<>"y"andz$<>"n"then63000
  153. 63004 ifz$="y"then170
  154. 63005 print"[147]load"chr$(34)"payload"chr$(34)",8":print"run"
  155. 63010 poke631,13:poke632,13:poke198,2:end
  156.